package com.wash.shoes.request;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.utils.StringUtils;
import com.wash.shoes.entity.ShoePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

@Data
@ApiModel(value = "查询鞋子参数")
public class ShoeQueryRequest extends ShoePo {
    @ApiModelProperty(value = "工厂id")
    private String factoryId;

    @JsonIgnore
    @ApiModelProperty(value = "是否分页")
    private boolean needPage;

    /**
     * 导出的时候增加验证,避免因为导出数量过多的情况
     */
    public void validate() {
        if (StringUtils.isEmpty(getOrderNumber()) && StringUtils.isEmpty(getPhone())
                && StringUtils.isEmpty(getWashCode()) && Objects.isNull(getStatus()) && StringUtils.isEmpty(getStorageUser()) && StringUtils.isEmpty(getFactoryId()) && StringUtils.isEmpty(getStartTime()) && StringUtils.isEmpty(getEndTime())) {
            throw new RuntimeException("导出不能全部导出,需要筛选条件.");
        }
    }
}
